package com.josework.springhelloworld.entity.Serialize;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;

public class SerialTest {
    //序列化
    public static void main(String[] args) {

        Persion p = new Persion(1L,"xulei");
        System.out.println("person Seria:" + p);

        try {
            FileOutputStream fos = new FileOutputStream("Persion.txt");
            ObjectOutputStream oos = new ObjectOutputStream(fos);
            oos.writeObject(p);
            oos.flush();
            oos.close();

        } catch (Exception e) {
            e.printStackTrace();
        }


    }
}
